import { get, post, del } from '@/common/js/httpHelper'

const getTempUserWithCondition = async (param) => {
  const getTempUserApiUrl = '/rest/users/list'
  const result = await post(getTempUserApiUrl, param)
  return result.data
}

const addTempUser = async (userData) => {
  const addTempUserApiUrl = '/rest/users/saveTempUser'
  const result = await post(addTempUserApiUrl, userData)
  return result.data
}

const deleteTempUser = async (id) => {
  const deleteTempUserApiUrl = '/rest/users/' + id
  const result = await del(deleteTempUserApiUrl)
  return result
}

const getTempUserDepartments = async () => {
  const getTempUserDepartmentsUrl = '/rest/users/getDepartments'
  const result = await get(getTempUserDepartmentsUrl)
  return result.data
}

export default {
  getTempUserWithCondition: getTempUserWithCondition,
  getTempUserDepartments: getTempUserDepartments,
  addTempUser: addTempUser,
  deleteTempUser: deleteTempUser
}
